<template>
  <el-radio-group :value="value" :disabled="disabled" @input="handleInput" @change="changeHandle">
    <el-radio v-for="role in filterMap" v-show="ifShow(role)" :label="role.code_id" :key="role.code_id" :value="role.code_id" >
      {{ role.code_cn_desc }}
    </el-radio>
  </el-radio-group>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  name: 'Radio',
  model: {
    prop: 'value',
    event: 'input'
  },
  props: {
    hiddenValue: {
      type: Array,
      default() {
        return []
      }
    },
    defaultValue: [Number, String],
    value: [String, Number],
    type: [String, Number],
    disabled: {
      type: Boolean,
      default() {
        return false
      }
    }
  },
  data() {
    return {}
  },

  computed: {
    filterMap() {
      return this.dictMap[this.type]
    },
    ...mapGetters(['dictMap'])
  },

  methods: {
    ifShow(role) {
      if (this.hiddenValue.indexOf(role.code_id) === -1) {
        return true
      } else {
        return false
      }
    },
    handleInput(event) {
      this.$emit('input', event)
    },
    changeHandle() {
      this.$emit('ifChange', true)
    }
  }
}
</script>

<style scoped>
</style>
